#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<bits/stdc++.h>
#define fi first
#define se second
#define SIZE(x) ((int)x.size())
#define out(x) cerr<<#x<<" = "<<(x)<<endl;
#define MP(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;
#define VI vector<int>
#define VVI vector< vector<int> >
#define VC vector<char>
#define PI pair<int,int>
#define PL pair<ll,ll>
#define EPS 0.0000001


inline int lson(int x){return x<<1;}
inline int rson(int x){return (x<<1)|1;}

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}

template<typename T> 
inline void read(T &x){
	x=0;T f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}
const int maxn=11000;
int ch[maxn][26];
int siz[maxn];
int fail[maxn];
int cnt=0;

void ins(char *s,int id){
	int p=0,tmp;
	while(*s){
		tmp=*s-'a';
		if(!ch[p][tmp])ch[p][tmp]=++cnt;
		p=ch[p][tmp];
		++s;
	}
	siz[p]=id;
}
void build(){
	queue<int> q;
	for(int i=0;i<26;i++)if(ch[0][i])q.push(ch[0][i]);
	while(!q.empty()){
		int id=q.front();q.pop();
		for(int i=0;i<26;i++)
		if(ch[id][i])
			fail[ch[id][i]]=ch[fail[id]][i],q.push(ch[id][i]);
		else ch[id][i]=ch[fail[id]][i];
	}
}

char pat[155][80];
int num[155];
char inp[1000005];
//AC自动机
int main(){
    #ifdef BUG
    freopen("a.in","r",stdin);
    #endif
	int n;
	while(n=read()){
		memset(ch,0,sizeof ch);
		memset(siz,0,sizeof siz);
		memset(num,0,sizeof num);
		memset(fail,0,sizeof fail);
		cnt=0;
		for(int i=1;i<=n;i++){
			scanf("%s",pat[i]);
			ins(pat[i],i);
		}
		build();
		scanf("%s",inp);
		char *s=inp;
		int p=0;
		while(*s){
			p=ch[p][*s-'a'];
			for(int t=p;t;t=fail[t])if(siz[t])++num[siz[t]];
			++s;
		}
		int mm=0;
		for(int i=1;i<=n;i++)mm=max(mm,num[i]);
		printf("%d\n",mm);
		for(int i=1;i<=n;i++)if(mm==num[i])printf("%s\n",pat[i]);
	}
}